require('dotenv').config();
const mongoose = require("mongoose") 
const username = process.env.MONGODB_USERNAME || 'default_username';  
const password = process.env.MONGODB_PASSWORD || 'default_password'; 
mongoose.connect(`mongodb://${username}:${password}@47.93.162.7:27017/?authMechanism=DEFAULT&authSource=WXxcx`)
// mongoose.connect("mongodb://WXxcx:167116@47.93.162.7:27017/?authMechanism=DEFAULT&authSource=WXxcx")
let con = mongoose.connection

con.on("open",()=>{
    console.log("连接成功");
})

con.on("error",(err)=>{
    console.log(err);
})

module.exports=mongoose